<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //清除字符串的首或尾空格 中间的不会清除
        const s = ' a b c ';
        console.log(s.trimStart()); //头部
        console.log(s.trimEnd()); //尾部
        console.log(s.trimLeft()); //左边
        console.log(s.trimRight()); //右边
        consol e.log(s.trim()); //左右(头尾)两边部分
    </script>

</body>

</html>